inter thread communication in java simple example